public class AdjustNum {
    //调整数组顺序使得奇数位于偶数之前。调整之后，不关心大小顺序。
    public static void main(String[] args) {
        int[] array = {0,1,6,2,9,5,3,7,4};
        int left = 0;
        int right = array.length - 1;
        int ret = 0;
        while(left <= right) {
            if(0 == array[left]%2) {
                ret = array[left];
                array[left] = array[right];
                array[right] = ret;
                right--;
            } else if (0 != array[left] % 2) {
                left++;
            }
        }
        for(int i = 0; i < array.length; i++) {
            System.out.print(array[i] + " ");
        }
        System.out.println();
    }
}
